const fs = require('fs')
function readFile(pathname) {
    let format;
    if(pathname.indexOf('.png') !== -1 || pathname.indexOf('.jpg') !== -1) {
        format = null;
    } else {
        format = 'utf-8';
    }

    return new Promise((resolve, reject) => {
        fs.readFile(pathname, format, (err, res) => {
            if (err !== null) {
                reject(err)
                return
            }
            resolve(res)
        })
    })
}
module.exports = {
    readFile
}